const path = require("path");

const resolve = (dir) => path.join(__dirname, dir);

module.exports = {
  //  基本路径
  publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
  outputDir: "dist",
  assetsDir: "static",
  indexPath: "index.html",
  devServer: {
    hot: true,
  },
  // 安装style-resources-loader和vue-cli-plugin-style-resources-loader后配置全局变量
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      // 引入全局样式文件
      patterns: [path.resolve(__dirname, "./src/styles/dwVariables.less")],
    },
  },
  configureWebpack: (config) => {
    //关闭 webpack 的性能提示
    config.performance = {
      hints: false,
    };
    // 告诉 webpack 解析模块时应该搜索的目录
    config.resolve.modules = ["node_modules"];
    // 删除打印
    // config.optimization = {
    //   minimizer: [
    //     new terserPlugin({
    //       terserOptions: {
    //         compress: {
    //           warnings: false,
    //           drop_console: true,
    //           drop_debugger: true,
    //           pure_funcs: ["console.log"],
    //         },
    //       },
    //     }),
    //   ],
    // };
  },
};
